class Solution(object):
    def numDecodings(self, s):
        """
        :type s: str
        :rtype: int
        """

        l = len(s)
        if l==0:
            return 0
        f = [0] * (l+1)
        f[0] = 1
        if l==1:
            return 1
        for i in range(1,l+1):
            if int(s[i-1]) >=1  and int(s[i-1])<= 9:
                f[i]+= f[i-1]
            if int(s[i-2])*10+int(s[i-1]) >= 10 and int(s[i-2])*10+int(s[i-1]) <=26:
                f[i]+=f[i-2]
        return f[-1]


s="226"
m =Solution()
h=m.numDecodings(s)
print(h)
